<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head th:include="common/head :: htmlhead">

<body>
<link rel="stylesheet" th:href="@{/static/plugins/sweetalert.css}">
<script th:src="@{/static/plugins/sweetalert.min.js}"></script>
<style>
    .layui-form-select dl {
        z-index: 9999999999999999999999;
    }
</style>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">内容详情</div>
                <div class="layui-card-body">
                    <div class="layui-form">
                        <div class="layui-field-box">
                            <div class="layui-row layui-col-space10">
                                <div class="layui-col-md9">
                                    <div class="layui-row layui-col-space10 layui-form-item">
                                        <div class="layui-col-lg12">
                                            <label class="layui-form-label">会员名称</label>
                                            <div class="layui-input-block">
                                                <input id="id" class="layui-input" type="hidden" readonly
                                                       th:value="${frontUnion.id}">
                                                <input class="layui-input" readonly th:value="${name}">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-row layui-col-space10 layui-form-item">
                                        <div class="layui-col-lg12">
                                            <label class="layui-form-label">文章内容</label>
                                            <div class="layui-input-block">
                                                <div th:utext="${frontUnion.context}"></div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-col-md3">
                                    <div class="layui-row" style="text-align:center">
                                        <img class="layui-upload-img" id="demo1" style="width: 150px;height: 150px;"
                                             th:src="${'getPic?picid=' + frontUnion.picid}">
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <div class="layui-input-block">
                                        <button th:if="${show} ne 'no'" type="button" class="layui-btn"
                                                onClick="publish()">通过
                                        </button>
                                        <button th:if="${show} ne 'no'" type="button" class="layui-btn layui-btn-warm"
                                                onClick="setback()">打回
                                        </button>
                                        <button type="button" class="layui-btn layui-btn-primary"
                                                onClick="history.go(-1);">返回
                                        </button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</div>
<script th:inline="javascript" type="text/javascript">
    // var show = [[${show}]];
    // if (show === "no") {
    //     $("#showbtn").attr("style","display:none;");
    // }

    function publish() {
        layer.confirm('确定通过？', function (index) {
            var frontunionid = document.getElementById("id").value;
            $.ajax({
                url: "/postfrontunion",
                async: false,
                type: "POST",
                dataType: "text",
                data: {"id": frontunionid},
                success: function (aa) {
                    if (aa === "error") {
                        layer.open({
                            title: '信息'
                            , content: '通过失败！'
                            , end: function () {
                                location.reload();
                            }
                        });
                    } else if (aa === "success") {
                        layer.open({
                            title: '信息'
                            , content: '通过成功！'
                            , end: function () {
                                history.go(-1);
                            }
                        });
                    }
                }
            })
            layer.close(index);
        });
    }

    function setback() {
        window.location.href = "/setback?id=" + [[${frontUnion.id}]] + "&type=user";
    }

    layui.use('form', function () {
        var form = layui.form;
        form.render(null, 'component-form-element');
    });

</script>
</body>